package JavaSEAdvance.day05_API.D507_HomeWork;

import java.math.BigDecimal;

/**
 * @author Xiao
 * @date 2021/7/21
 */
public class Test01 {
    /**
     * 1. 已知圆的半径是13，求圆的面积，将运算结果四舍五入保留两位小数。
     */
    public static void main(String[] args) {
        double r = 13;
//        double s = r * r * Math.PI;
        double s = Math.PI * Math.pow(r, 2);
        System.out.println(s);

        /*BigDecimal bd = new BigDecimal(s);
        BigDecimal bd1 = new BigDecimal(1.0);
        BigDecimal result = bd.divide(bd1, 2, BigDecimal.ROUND_HALF_UP);*/

        long l = Math.round(s * 100);
        double result = l / 100.0;
        System.out.println(result);
    }
}
